from collections import defaultdict
from skidl import Pin, Part, Alias, SchLib, SKIDL, TEMPLATE

from skidl.pin import pin_types

SKIDL_lib_version = '0.0.1'

Driver_Relay = SchLib(tool=SKIDL).add_parts(*[
        Part(**{ 'name':'DRV8860', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'DRV8860'}), 'ref_prefix':'U', 'fplist':['Package_SO:TSSOP-16_4.4x5mm_P0.65mm'], 'footprint':'Package_SO:TSSOP-16_4.4x5mm_P0.65mm', 'keywords':'Relay Driver', 'description':'', 'datasheet':'http://www.ti.com/lit/ds/symlink/drv8860.pdf', 'search_text':'/usr/share/kicad/symbols/Driver_Relay.kicad_sym\nDRV8860\n\nRelay Driver', 'pins':[
            Pin(num='1',name='VM',func=pin_types.PWRIN,unit=1),
            Pin(num='10',name='OUT7',func=pin_types.OUTPUT,unit=1),
            Pin(num='11',name='OUT6',func=pin_types.OUTPUT,unit=1),
            Pin(num='12',name='OUT5',func=pin_types.OUTPUT,unit=1),
            Pin(num='13',name='OUT4',func=pin_types.OUTPUT,unit=1),
            Pin(num='14',name='OUT3',func=pin_types.OUTPUT,unit=1),
            Pin(num='15',name='OUT2',func=pin_types.OUTPUT,unit=1),
            Pin(num='16',name='OUT1',func=pin_types.OUTPUT,unit=1),
            Pin(num='2',name='DIN',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='SCLK',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='Latch',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='6',name='DOUT',func=pin_types.OUTPUT,unit=1),
            Pin(num='7',name='FAULT',func=pin_types.OPENCOLL,unit=1),
            Pin(num='8',name='ENABLE',func=pin_types.INPUT,unit=1),
            Pin(num='9',name='OUT8',func=pin_types.OUTPUT,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'DRV8860_PWPR', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'DRV8860_PWPR'}), 'ref_prefix':'U', 'fplist':['Package_SO:TSSOP-16-1EP_4.4x5mm_P0.65mm'], 'footprint':'Package_SO:TSSOP-16-1EP_4.4x5mm_P0.65mm', 'keywords':'Relay Driver', 'description':'', 'datasheet':'http://www.ti.com/lit/ds/symlink/drv8860.pdf', 'search_text':'/usr/share/kicad/symbols/Driver_Relay.kicad_sym\nDRV8860_PWPR\n\nRelay Driver', 'pins':[
            Pin(num='1',name='VM',func=pin_types.PWRIN,unit=1),
            Pin(num='10',name='OUT7',func=pin_types.OUTPUT,unit=1),
            Pin(num='11',name='OUT6',func=pin_types.OUTPUT,unit=1),
            Pin(num='12',name='OUT5',func=pin_types.OUTPUT,unit=1),
            Pin(num='13',name='OUT4',func=pin_types.OUTPUT,unit=1),
            Pin(num='14',name='OUT3',func=pin_types.OUTPUT,unit=1),
            Pin(num='15',name='OUT2',func=pin_types.OUTPUT,unit=1),
            Pin(num='16',name='OUT1',func=pin_types.OUTPUT,unit=1),
            Pin(num='17',name='PAD',func=pin_types.PWRIN,unit=1),
            Pin(num='2',name='DIN',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='SCLK',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='Latch',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='6',name='DOUT',func=pin_types.OUTPUT,unit=1),
            Pin(num='7',name='FAULT',func=pin_types.OPENCOLL,unit=1),
            Pin(num='8',name='ENABLE',func=pin_types.INPUT,unit=1),
            Pin(num='9',name='OUT8',func=pin_types.OUTPUT,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'MAX4820xUP', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'MAX4820xUP'}), 'ref_prefix':'U', 'fplist':['Package_SO:HTSSOP-20-1EP_4.4x6.5mm_P0.65mm_EP2.85x4mm'], 'footprint':'Package_SO:HTSSOP-20-1EP_4.4x6.5mm_P0.65mm_EP2.85x4mm', 'keywords':'Relay Driver', 'description':'', 'datasheet':'https://datasheets.maximintegrated.com/en/ds/MAX4820-MAX4821.pdf', 'search_text':'/usr/share/kicad/symbols/Driver_Relay.kicad_sym\nMAX4820xUP\n\nRelay Driver', 'pins':[
            Pin(num='17',name='OUT3',func=pin_types.OPENCOLL),
            Pin(num='18',name='GND',func=pin_types.PASSIVE),
            Pin(num='19',name='OUT2',func=pin_types.OPENCOLL),
            Pin(num='20',name='OUT1',func=pin_types.OPENCOLL),
            Pin(num='21',name='GND',func=pin_types.PASSIVE),
            Pin(num='9',name='GND',func=pin_types.PWRIN),
            Pin(num='1',name='VCC',func=pin_types.PWRIN,unit=1),
            Pin(num='10',name='OUT8',func=pin_types.OPENCOLL,unit=1),
            Pin(num='11',name='OUT7',func=pin_types.OPENCOLL,unit=1),
            Pin(num='12',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='13',name='OUT6',func=pin_types.OPENCOLL,unit=1),
            Pin(num='14',name='OUT5',func=pin_types.OPENCOLL,unit=1),
            Pin(num='15',name='COM',func=pin_types.PASSIVE,unit=1),
            Pin(num='16',name='OUT4',func=pin_types.OPENCOLL,unit=1),
            Pin(num='2',name='~{SET}',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='~{RESET}',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='~{CS}',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='DIN',func=pin_types.INPUT,unit=1),
            Pin(num='6',name='SCLK',func=pin_types.INPUT,unit=1),
            Pin(num='7',name='DOUT',func=pin_types.OUTPUT,unit=1),
            Pin(num='8',name='NC',func=pin_types.NOCONNECT,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'MAX4821xUP', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'MAX4821xUP'}), 'ref_prefix':'U', 'fplist':['Package_SO:HTSSOP-20-1EP_4.4x6.5mm_P0.65mm_EP2.85x4mm'], 'footprint':'Package_SO:HTSSOP-20-1EP_4.4x6.5mm_P0.65mm_EP2.85x4mm', 'keywords':'Relay Driver', 'description':'', 'datasheet':'https://datasheets.maximintegrated.com/en/ds/MAX4820-MAX4821.pdf', 'search_text':'/usr/share/kicad/symbols/Driver_Relay.kicad_sym\nMAX4821xUP\n\nRelay Driver', 'pins':[
            Pin(num='17',name='OUT3',func=pin_types.OPENCOLL),
            Pin(num='18',name='GND',func=pin_types.PASSIVE),
            Pin(num='19',name='OUT2',func=pin_types.OPENCOLL),
            Pin(num='20',name='OUT1',func=pin_types.OPENCOLL),
            Pin(num='21',name='GND',func=pin_types.PASSIVE),
            Pin(num='9',name='GND',func=pin_types.PWRIN),
            Pin(num='1',name='VCC',func=pin_types.PWRIN,unit=1),
            Pin(num='10',name='OUT8',func=pin_types.OPENCOLL,unit=1),
            Pin(num='11',name='OUT7',func=pin_types.OPENCOLL,unit=1),
            Pin(num='12',name='GND',func=pin_types.PASSIVE,unit=1),
            Pin(num='13',name='OUT6',func=pin_types.OPENCOLL,unit=1),
            Pin(num='14',name='OUT5',func=pin_types.OPENCOLL,unit=1),
            Pin(num='15',name='COM',func=pin_types.PASSIVE,unit=1),
            Pin(num='16',name='OUT4',func=pin_types.OPENCOLL,unit=1),
            Pin(num='2',name='~{SET}',func=pin_types.INPUT,unit=1),
            Pin(num='3',name='~{RESET}',func=pin_types.INPUT,unit=1),
            Pin(num='4',name='~{CS}',func=pin_types.INPUT,unit=1),
            Pin(num='5',name='LVL',func=pin_types.INPUT,unit=1),
            Pin(num='6',name='A0',func=pin_types.INPUT,unit=1),
            Pin(num='7',name='A1',func=pin_types.INPUT,unit=1),
            Pin(num='8',name='A2',func=pin_types.INPUT,unit=1)], 'unit_defs':[] }),
        Part(**{ 'name':'TPL9201_TSSOP', 'dest':TEMPLATE, 'tool':SKIDL, 'aliases':Alias({'TPL9201_TSSOP'}), 'ref_prefix':'U', 'fplist':['Package_SO:HTSSOP-20-1EP_4.4x6.5mm_P0.65mm_EP3.4x6.5mm_ThermalVias'], 'footprint':'Package_SO:HTSSOP-20-1EP_4.4x6.5mm_P0.65mm_EP3.4x6.5mm_ThermalVias', 'keywords':'Relay Driver', 'description':'', 'datasheet':'http://www.ti.com/lit/ds/symlink/tpl9201.pdf', 'search_text':'/usr/share/kicad/symbols/Driver_Relay.kicad_sym\nTPL9201_TSSOP\n\nRelay Driver', 'pins':[
            Pin(num='1',name='ZVS',func=pin_types.OUTPUT,unit=1),
            Pin(num='10',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='11',name='GND',func=pin_types.PWRIN,unit=1),
            Pin(num='12',name='EN1',func=pin_types.INPUT,unit=1),
            Pin(num='13',name='Rdelay',func=pin_types.OUTPUT,unit=1),
            Pin(num='14',name='RST',func=pin_types.BIDIR,unit=1),
            Pin(num='15',name='MOSI',func=pin_types.INPUT,unit=1),
            Pin(num='16',name='CS',func=pin_types.INPUT,unit=1),
            Pin(num='17',name='SCLK',func=pin_types.INPUT,unit=1),
            Pin(num='18',name='5Vout',func=pin_types.PWROUT,unit=1),
            Pin(num='19',name='Vin',func=pin_types.PWRIN,unit=1),
            Pin(num='2',name='OUT1',func=pin_types.OUTPUT,unit=1),
            Pin(num='20',name='SYN',func=pin_types.INPUT,unit=1),
            Pin(num='21',name='PAD',func=pin_types.PWRIN,unit=1),
            Pin(num='3',name='OUT2',func=pin_types.OUTPUT,unit=1),
            Pin(num='4',name='OUT3',func=pin_types.OUTPUT,unit=1),
            Pin(num='5',name='OUT4',func=pin_types.OUTPUT,unit=1),
            Pin(num='6',name='OUT5',func=pin_types.OUTPUT,unit=1),
            Pin(num='7',name='OUT6',func=pin_types.OUTPUT,unit=1),
            Pin(num='8',name='OUT7',func=pin_types.OUTPUT,unit=1),
            Pin(num='9',name='OUT8',func=pin_types.OUTPUT,unit=1)], 'unit_defs':[] })])